<template>
  <div id="app">
    <h1> {{msg}} -- {{on}}</h1>
    <input type="text" v-model="msg">
    <button v-if="on"  @click="onOff" > 开 </button>
    <button v-else @click="onOff">关</button>


    <h3> 组件 </h3>
    <ul>
      <todoItem v-for="item in array" :key="'p'+item" :msg="item"  ></todoItem>
    </ul>
  </div>
</template>

<script>


import todoItem from "@/components/todoItem";

export default {
  name: 'App',
  data:function (){
    return {
      msg:'hello',
      on:true,
      array:[1,2,3,4,6]
    }
  },
  methods:{
    onOff:function (){
      this.on = !this.on
    }
  },
  components: {
    todoItem
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
